﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace Ams.Mvc.Bootstrap
{
    public static class BootstrapDisplayExtensions
    {

        public static MvcHtmlString DisplayFor<TModel, TValue>(this BootstrapHelper<TModel> helper, Expression<Func<TModel, TValue>> expression)
        {
            return DisplayFor(helper, expression, null);
        }
        public static MvcHtmlString DisplayFor<TModel, TValue>(this BootstrapHelper<TModel> helper, Expression<Func<TModel, TValue>> expression, object htmlAttributes)
        {
            return DisplayFor(helper, expression, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
        }
        public static MvcHtmlString DisplayFor<TModel, TValue>(this BootstrapHelper<TModel> helper, Expression<Func<TModel, TValue>> expression, IDictionary<string, object> htmlAttributes)
        {
            var additionalViewData = new { htmlAttributes };
            var html = DisplayExtensions.DisplayFor(helper.Html, expression, additionalViewData);
            return html;
        }
    }
}
